<template>
	<view>
		<view class='ikz-address' @click="radioChange">
			<view class="ikz-address-img">
				<image src="/static/img/address/wei.png"></image>
			</view>
			<block v-if="addr=='' ">
				<view class="ikz-address-reciver">
					您没有默认收货地址,点击去新增！
				</view>
			</block>
			<block v-else>
				<view class="ikz-address-tips">
					<view class="ikz-address-tips-name">
						<view>
							<text>{{addr.name}} </text> {{addr.mobile}}</view>
						<view>{{addr.address}} {{addr.house_num}} </view>
					</view>
				</view>
				<view class="ikz-arrow"></view>
			</block>
		</view>
		<view class="ikz-address-br">
		</view>
	</view>
</template>


<script>
	var app = getApp();
	import ikz from '@/pages/Common/tools.js'
	export default {
		components: {},
		props: {
			pull: {
				type: Boolean,
				default: false
			},
			onshow: {
				type: String,
			}
		},
		data() {
			return {
				addr: '',
			}
		},
		created() {
			this.addr = app.globalData.user_address.address_default;
			this.getClassInfo((res) => {

			})

		},
		watch: {
			onshow:{
				handler(newName, oldName) {
					console.log('加载');
					this.addr = app.globalData.user_address.address_default;
					console.log(this.addr);
					this.getClassInfo((res) => {
					
					})
				},
				immediate: true,
				deep: true
			},
			
		},
		methods: {
			radioChange(){
				var url = '/pages/Component/Module/Address/Program/myAddress/index?reback=3';
				ikz.nav(url, 'ln');
			},
			//获取相关数据
			getClassInfo(fn) {
				let that = this;
				//开始获取相关信息
				var path = '/Supply/Wechat/Release/releaseClassInfo';
				ikz.get(path, {}, (res) => {
					if (res.data.status == 'success') {
						//数据请求成功
						that.class_info = res.data.info;
					}
					//返回参数
					fn(res);
				});

			},
		}
	}
</script>

<style>
	.ikz-address {
		/* background-color: #fff;
	    margin-top: 20rpx; */
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 20rpx;
		font-size: 25rpx;
		line-height: 40rpx;
		background: #fff;
		color: #353535;
	}

	.ikz-address-img {
		height: 50rpx;
		margin-left: 20rpx;
		width: 8%;
	}

	.ikz-address-img image {
		width: 50rpx;
		height: 50rpx;
	}

	.ikz-address-tips {
		width: 80%;
	}

	.ikz-address-reciver {
		width: 80%;
	}


	/* 箭头 默认灰色字体*/

	.ikz-arrow {
		color: #999;
		display: inline-block;
		border-right: 1rpx solid;
		border-bottom: 1rpx solid;
		width: 15rpx;
		height: 15rpx;
		transform: rotate(-45deg);
	}

	/* 箭头 */

	.ikz-address-br {
		width: 100%;
		height: 10rpx;
	}

	.ikz-address-br image {
		width: 100%;
		height: 10rpx;
	}
</style>
